package com.zjh.r2dbc.config;

import com.zjh.r2dbc.convert.EmpConvert;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.r2dbc.convert.R2dbcCustomConversions;
import org.springframework.data.r2dbc.dialect.MySqlDialect;
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;

@Configuration
@EnableR2dbcRepositories //开启r2dbc仓库功能
public class ApplicationConfig {
    @Bean
    @ConditionalOnMissingBean
    public R2dbcCustomConversions customConversions(){
        //加入我们的转换器
        return R2dbcCustomConversions.of(MySqlDialect.INSTANCE,new EmpConvert());
    }
}